import { createApp } from 'vue'
//import './style.css'
import App from './App.vue'
import router from './router/index';
//引入element-plus
import ElementPlus from 'element-plus'
import 'element-plus/dist/index.css'
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
//国际化
import zhCn from "element-plus/es/locale/lang/zh-cn";
//引入pinia构造函数
import { createPinia } from 'pinia';
import piniaPersist from 'pinia-plugin-persist'
import myconfirm from './utils/myconfirm';
//charts
import * as echarts from 'echarts';
//权限验证
import './permisson'
//按钮权限指令
//import { permisson } from "./directive/permission";
import hasPerm from './directive/hasPerm'


//实例化pinia
const pinia = createPinia()
pinia.use(piniaPersist)//使用持久化插件

const app = createApp(App);
//app.directive('permission',permission)
app.use(ElementPlus, {
    locale: zhCn
}).use(router).use(pinia).mount('#app')
//全局挂载
app.config.globalProperties.$echarts = echarts;
app.config.globalProperties.$myconfirm = myconfirm;
app.config.globalProperties.$hasPerm = hasPerm
//全局注册图标组件
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}